import request from '@/utils/request'

// 设备搜索
export const searchVmApi = params => request.get('/vm-service/vm/search',{
  params
})

// 设备型号
export const getVmTypeApi = params => request.get('/vm-service/vmType/search', { params })

// 新增设备
export const addVmApi = data => request.post('/vm-service/vm', data)

// 获取策略列表
export const getPolicyApi = data => request.get('/vm-service/policy', data)

// 应用策略
export const applyPolicyApi = data => request.put('/vm-service/vm/applyPolicy', data)

// 修改售货机点位
export const editVmNodeApi = data => request.put(`/vm-service/vm/${data.id}/${data.nodeId}`)

// 查询售货机策略
export const getPolicyInfoApi = id => request.get(`/vm-service/policy/vmPolicy/${id}`)

// 取消售货机策略
export const cancelVmPolicyApi = data => request.put(`/vm-service/vm/cancelPolicy/${data.innerCode}/${data.policyId}`)

// 获取售货机货道详情
export const getVmGoodsApi = id => request.get(`/vm-service/channel/channelList/${id}`)

// 获取售货机类型详情
export const getVmTypeInfoApi = id => request.get(`/vm-service/vmType/${id}`)

// 获取商圈下销量前10的商品(补货推荐)
export const getSalesTopApi = id => request.get(`/vm-service/sku/businessTop10/${id}`)

// 获取售货机所在商圈
export const getCurrentBsNameApi = id => request.get(`/vm-service/businessType/name/${id}`)

// 商品搜索
export const searchGoodsApi = params => request.get(`/vm-service/sku/search`, { params })

// 货道配置
export const channelConfigApi = data => request.put('/vm-service/channel/channelConfig', data)

// 获取一定时间范围之内的订单总数
export const getOrderCountApi = params => request.get('/order-service/report/orderCount', { params })

// 获取一定时间范围之内的收入
export const getOrderAmountApi = params => request.get('/order-service/report/orderAmount', { params })

// 获取售货机补货次数
export const getSupplyCountApi = (params, data) => request.get(`/task-service/task/supplyCount/${params.innerCode}/${params.start}/${params.end}`, data)

// 获取售货机维修次数
export const getRepairCountApi = (params, data) => request.get(`/task-service/task/repairCount/${params.innerCode}/${params.start}/${params.end}`, data)

// 获取售货机商品销量
export const getSkuCollectApi = (params, data) => request.get(`/order-service/report/skuCollect/${params.innerCode}/${params.start}/${params.end}`, data)

// 上传图片
export const fileUpload = data => request.post(`/vm-service/sku/fileUpload`, data)

// 新增售货机类型
export const addVmTypeApi = data => request.post('/vm-service/vmType', data)

// 删除售货机类型
export const delVmTypeApi = id => request.delete(`/vm-service/vmType/${id}`)

// 修改售货机类型
export const editVmTypeApi = (id, data) => request.put(`/vm-service/vmType/${id}`, data)
